/*
 *
 *      Copyright (c) 2018-2025, st All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: st
 *
 */

package com.mkh.st.admin.api.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mkh.st.admin.api.dto.*;
import com.mkh.st.admin.api.entity.SysUser;
import com.mkh.st.admin.api.vo.DataPermissionVO;
import com.mkh.st.admin.api.vo.UserIdNameVO;
import com.mkh.st.admin.api.vo.UserPurchasePageVO;
import com.mkh.st.common.core.constant.ServiceNameConstants;
import com.mkh.st.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author st
 * @date 2018/6/22
 */
@FeignClient(contextId = "sysUserProvider", value = ServiceNameConstants.UPMS_SERVICE,url ="${st.adminUrl:}")
public interface ISysUserProvider {

	/**
	 * 通过用户账号查询用户、角色信息
	 * @param phone 用户账号
	 * @return R
	 */
	@GetMapping("/user/provider/info/{phone}")
	R<UserInfo> info(@PathVariable("phone") String phone);

	/**
	 * 通过社交账号或手机号查询用户、角色信息
	 * @param inStr appid@code
	 * @return
	 */
	@GetMapping("/user/provider/social/info/{inStr}")
	R<UserInfo> social(@PathVariable("inStr") String inStr);

	/**
	 * 查询上级部门的用户信息
	 * @param username 用户名
	 * @return R
	 */
	@GetMapping("/user/provider/ancestor/{username}")
	R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);

	/**
	 * 账户锁定
	 * @param dto
	 * @return
	 */
	@PostMapping("/user/provider/lockUserStatus")
    R<Boolean> lockUserStatus(@RequestBody UserLockDTO dto);


	@GetMapping("/user/provider/getUserDataPermisstion")
	R<DataPermissionVO> getUserDataPermisstion(@RequestParam(value = "docTypeCode",required = false)  String docTypeCode,@RequestParam("menuCode") String menuCode);

	/**
	 * 采购员分页查询
	 * @param dto
	 * @return
	 */
	@GetMapping(value = "/user/provider/purchaseUserPage")
	R<Page<UserPurchasePageVO>> purchaseUserPage(@SpringQueryMap UserPurchasePageDTO dto);

	/**
	 * 采购员list查询
	 * @param dto
	 * @return
	 */
	@GetMapping("/user/provider/purchaseUserList")
	R<List<UserPurchasePageVO>> purchaseUserList(@SpringQueryMap UserPurchasePageDTO dto);

	/**
	 * 客户信息维护
	 * @param dto
	 * @return
	 */
	@PostMapping("/user/provider/otherUserSave")
	R<Long> otherUserSave(@RequestBody @Valid OtherUserDTO dto);


	@PostMapping("/user/provider/deleteUser")
	R<Boolean> deleteUser(@RequestBody @Valid DeleteDto dto);

	/**
	 * 用户名称查询
	 * @param ids
	 * @return
	 */
	@GetMapping(value = "/user/provider/getUserNameList")
	R<List<UserIdNameVO>> getUserNameList(@RequestParam("ids") String ids);

	@GetMapping(value = "/user/provider/getSaleUserList")
	R<List<UserIdNameVO>> getSaleUserList(@RequestParam("businessType") Integer businessType);

	@GetMapping(value = "/user/provider/checkUserPermission")
	R<Boolean> checkUserPermission(@RequestParam("menuCode") String menuCode,@RequestParam("scopeId") Long scopeId,@RequestParam("name") String name);

	@GetMapping(value = "/user/provider/getUserAccountList")
	R<List<UserIdNameVO>> getUserAccountList(@RequestParam("menuCode") String menuCode);


	@PostMapping("/user/provider/addScopeData")
	R<Boolean> addScopeData(@RequestBody @Valid ScopoDataDTO dto);

}
